<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr = [12, 20, 39];
        //arr[0] = prompt("请输入数字")
        console.log(arr[0] = 12);
        let arr2 = ['zhangsan', 'liudehua', 'heima'];
        console.log(arr2.length);
        const G = 3.14;//const修饰的为常量

        //数据类型：基本数据类型和引用类型
        //单引号、双引号、反引号包裹的数据为字符串
        let str = `str2`;
        let str2 = str + "hello";//字符串拼接
        console.log(str2);

        //模板字符串
        let a = 20;
        document.write(`数字为${a}`);
        let bool = true;
        console.log(bool);

        //通过typeof x检测数字类型
        console.log(typeof a);//作为运算符
        console.log(typeof (bool));//作为函数形式
        console.log(typeof (+'123'));//转换为数字型
        console.log(typeof (1 - '12'));//减号变为数字型

        //显示转化
        console.log(Number('88'));
        //parseInt(数据),只保留整数
        console.log(typeof (parseInt('400px')));
        //parseFloat(数据)转换成小数
        console.log("---------------------------");

        console.log(parseFloat(12));

    </script>
</body>

</html>